package com.zh.authority.dao;

import javacommon.base.*;
import cn.org.rapid_framework.page.*;
import com.zh.authority.model.*;
import com.zh.authority.vo.query.*;
import static cn.org.rapid_framework.util.ObjectUtils.*;
import org.springframework.stereotype.Repository;
/**
 * @author grey2 email:grey2@126.com
 * @version 1.0
 * @since 1.0
 */
@SuppressWarnings("unchecked")
@Repository
public class UserDao extends BaseHibernateDao<User,java.lang.Integer>{

	public Class getEntityClass() {
		return User.class;
	}
	
	public Page findPage(UserQuery query) {
        //XsqlBuilder syntax,please see http://code.google.com/p/rapid-xsqlbuilder
        // [column]为字符串拼接, {column}为使用占位符. [column]为使用字符串拼接,如username='[username]',偷懒时可以使用字符串拼接 
        // [column] 为PageRequest的属性
		String sql = "select t from User t where 1=1 "
			  	+ "/~ and t.userName like '%[userName]%' ~/"
			  	+ "/~ and t.password = {password} ~/"
			  	+ "/~ and t.email = {email} ~/"
			  	+ "/~ and t.phone = {phone} ~/"
				+ "/~ order by [sortColumns] ~/";
        
		return pageQuery(sql,query);
	}
	

}
